package com.qianfeng.service.impl;

import com.qianfeng.mapper.GoodsMapper;
import com.qianfeng.pojo.Goods;
import com.qianfeng.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName: GoodsServiceImpl
 * @Description: TODO
 * @author: Buke
 * @date: 2021-09-22 15:25:08
 * @since JDK 1.8
 */
@Service
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    private GoodsMapper goodsMapper;

    //查询
    @Override
    public List<Goods> findGoods() {
        return goodsMapper.selectById();
    }

    //多删
    @Override
    public void deleteAll(Integer[] ids) {
        goodsMapper.deleteAdd(ids);
    }

    //单删
    @Override
    public void deleteUserById(Integer id) {
        goodsMapper.deleteByPrimaryKey(id);
    }

    //修改
    @Override
    public void UpdateInformation(Goods goods) {
        goodsMapper.updateByPrimaryKeySelective(goods);
    }

    //增加
    @Override
    public void addGoods(Goods goods) {
        goodsMapper.insertSelective(goods);
    }
}
